//
// State.h
//
// Abstract class representing a State Space.
//
//
#ifndef __STATE_H__
#define __STATE_H__

#pragma once

#include <vector>

using namespace std;

typedef long StateID;
typedef double Cost;

enum GWAction
{
	N,
	NE,
	E,
	SE,
	S,
	SW,
	W,
	NW
};

#pragma warning(disable : 4482)

typedef vector<GWAction>	ActionList;
typedef vector<GWAction>	Solution;

class State
{
public:	
	// Get actions, make/retract an action, and check whether a state is a goal state.
	virtual void getActions(vector<GWAction> &actions) = 0;
	virtual void make(GWAction a) = 0;
	virtual void retract(GWAction a) = 0;

	// Get cost of an edge/heuristic estimate.
	virtual Cost getCost(GWAction a) = 0;
	virtual Cost getHeuristic() = 0;
	virtual bool isGoal() = 0;
	virtual bool isStart() = 0;
	virtual StateID getStateId() = 0;
	virtual bool setFromStateId(StateID stateId) = 0;
	string getGWActionName(GWAction a)
	{
		string str = "";
		/*
		switch (a)
		{
			case GWAction::N:		str = "N"; break;
			case GWAction::NE:	str = "NE"; break;
			case GWAction::E:		str = "E"; break;
			case GWAction::SE:	str = "SE"; break;
			case GWAction::S:		str = "S"; break;
			case GWAction::SW:	str = "SW"; break;
			case GWAction::W:		str = "W"; break;
			case GWAction::NW:	str = "NW"; break;
		}
		*/
		switch (a)
		{
			case GWAction::N:		str = "W"; break;
			case GWAction::NE:	str = "NW"; break;
			case GWAction::E:		str = "N"; break;
			case GWAction::SE:	str = "NE"; break;
			case GWAction::S:		str = "E"; break;
			case GWAction::SW:	str = "SE"; break;
			case GWAction::W:		str = "S"; break;
			case GWAction::NW:	str = "SW"; break;
		}
		return str;
	}
};

#endif // __STATE_H__